<template>
	<div id="app" :class="is_mobile ? 'h5' : ''">
		<pageHeader />
		<keep-alive><router-view v-if="$route.meta.keepAlive" /></keep-alive>
		<router-view v-if="!$route.meta.keepAlive" />
		<a href="XsolWebRunScanner://"  style="opacity: 0;position: absolute;top: 0;" id="XsolWebRunScanner">Start XsolWebRunScanner Service</a>
		<a href="XpodWebRunScanner://"  style="opacity: 0;position: absolute;top: 0;" id="XpodWebRunScanner">Start XpodWebRunScanner Service</a>
		

	</div>
</template>

<script>
import pageHeader from '@/components/common/pageHeader.vue'; //顶部搜索
import loginPagePop from '@/components/common/loginPagePop.vue'; //顶部搜索
import { mapState } from 'vuex';
export default {
	components: {
		pageHeader,
		loginPagePop
	},
	data() {
		return {
			is_mobile: false,
			webSocket: null
		};
	},
	computed: {
		...mapState(['is_login'])
	},
	beforeCreate() {},
	created() {
		this.$socket.connect('ws://localhost:8765');
	},
	mounted() {
		// this.initScale();
		this.$nextTick(()=>{
			document.querySelector('#XsolWebRunScanner').click();
			document.querySelector('#XpodWebRunScanner').click();
		})
	},
	beforeDestroy() {},
	methods: {
		initScale() {
			// console.log(' ************ 屏幕宽度 ************ ', document.documentElement.clientWidth);
			if (document.documentElement.clientWidth <= 768) {
				this.is_mobile = true;
			}
			if (document && document.documentElement && document.documentElement.clientWidth) {
				if (document.documentElement.clientWidth < 1280) {
					document.querySelector('body').style.overflowX = 'hidden';
					let $target = document.querySelector('[name="viewport"]');
					// document.querySelector('[name="viewport"]').setAttribute('content', 'width=device-width,  initial-scale=0.15');
					document.querySelector('[name="viewport"]').setAttribute('content', 'width=device-width,  initial-scale=4');
				}
			}
		}
	}
};
</script>
<style lang="less">
@import '~@/utils/swiper/swiper-bundle.min.css';
body {
	overflow-x: hidden;
	// min-height: 100vh;
}
.el-form-item__label {
	font-weight: bold;
	font-size: 18px !important;
	color: #333333;
}
#app {
	// min-height: 100vh;
}
</style>
